
function displayModel(ply,command,args)
	print(1)
	//if SERVER then return end
	print(2)

	local trace = ply:GetEyeTrace()
	local entity = trace.Entity
	
	if not IsValid(entity) then print(2) return end

	print(3)

	local Gun = ents.Create("prop_physics")
	Gun:SetModel("models/MaxOfS2D/logo_gmod_b.mdl")
	Gun:SetPos(entity:GetPos() + Vector(0,0,50))

	local oldDraw = entity.Draw

	


	function entity:Draw()

		//oldDraw()



		Gun:SetNoDraw(true)

		local pos = self:GetPos()
		local ang = self:GetAngles()

		-- Position the gun
		local gunPos = self:GetAngles():Up() * 40 + ang:Up() * (math.sin(CurTime() * 2))*1.2
		Gun:SetPos(pos + gunPos)


		-- Make it dance
		ang:RotateAroundAxis(ang:Right(),75)
		ang:RotateAroundAxis(ang:Forward(), (CurTime() * 180) % 360)
		Gun:SetAngles(ang)

		-- Draw the model
		if self:Getgunspawn() < CurTime() - 2 then
			//Gun:DrawModel()
			return
		elseif self:Getgunspawn() < CurTime() then -- Not when a gun just spawned
			return
		end

		//Gun:DrawModel()
	end
end

concommand.Add("displayModel2", displayModel)